package modell;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Id;

@Entity
@Table(name = "TB_CRONOGRAMA")
public class Cronograma {

	public Cronograma() {
		vPercMes = new LinkedHashMap<Integer, Cronograma>();
	}

	public Cronograma(modell.Servico servico, modell.Periodo periodo,
			modell.Obra obra, Double percMes, Date dataCadastro) {
		super();
		Servico = servico;
		Periodo = periodo;
		Obra = obra;
		PercMes = percMes;
		DataCadastro = dataCadastro;
	}

	public Cronograma(modell.Servico servico, Map<Integer, Cronograma> vPercMes) {
		super();
		Servico = servico;
		this.vPercMes = vPercMes;
	}

	@Id
	@GeneratedValue
	private Integer Id;

	@ManyToOne
	@JoinColumn(name = "ID_SERVICO", nullable = false)
	private Servico Servico;

	@ManyToOne
	@JoinColumn(name = "ID_PERIODO", nullable = false)
	private Periodo Periodo;

	@ManyToOne
	@JoinColumn(name = "ID_Obra", nullable = false)
	private Obra Obra;

	@Column(name = "PRD_PERCMES")
	private Double PercMes;

	@Column(name = "CON_DTCADASTRO", nullable = false)
	private Date DataCadastro;

	@ElementCollection
	private Map<Integer, Cronograma> vPercMes;
	
	@ElementCollection
	private Map<Integer, Double> vAcumMes;
	
	public Date getDataCadastro() {
		return DataCadastro;
	}

	public void setDataCadastro(Date dataCadastro) {
		DataCadastro = dataCadastro;
	}

	public Obra getObra() {
		return Obra;
	}

	public void setObra(Obra obra) {
		Obra = obra;
	}

	public Integer getId() {
		return Id;
	}

	public void setId(Integer id) {
		Id = id;
	}

	public Servico getServico() {
		return Servico;
	}

	public void setServico(Servico servico) {
		Servico = servico;
	}

	public Periodo getPeriodo() {
		return Periodo;
	}

	public void setPeriodo(Periodo periodo) {
		Periodo = periodo;
	}

	public Double getPercMes() {
		return PercMes;
	}

	public void setPercMes(Double percMes) {
		PercMes = percMes;
	}

	public Cronograma getvPercMes(int Mes) {
		return vPercMes.get(Mes);
	}
	

}
